package cn.keking.web.controller;

import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
/**
 *  页面跳转
 * @author yudian-it
 * @date 2017/12/27
 */
@Controller
public class IndexController {

    @RequestMapping(value = "index", method = RequestMethod.GET)
    public String go2Index(HttpSession session){
    	if(null == session.getAttribute("isLogin")){
    		return "redirect:/login";
    	}
    	boolean flag = (boolean) session.getAttribute("isLogin");
    	if(flag){
    		return "index";
    	}
    	return "redirect:/login";
    }

    @RequestMapping(value = "/", method = RequestMethod.GET)
    public String root() {
        return "redirect:/login";
    }
    @RequestMapping(value = "login", method = RequestMethod.GET)
    public String login(){
        return "login";
    }
}
